/*
 * Licensed to Elasticsearch B.V. under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch B.V. licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

using System;
using System.Runtime.Serialization;

namespace Nest
{
	public class XPackInfoResponse : ResponseBase
	{
		[DataMember(Name ="build")]
		public XPackBuildInformation Build { get; internal set; }
		[DataMember(Name ="features")]
		public XPackFeatures Features { get; internal set; }
		[DataMember(Name ="license")]
		public MinimalLicenseInformation License { get; internal set; }
		[DataMember(Name ="tagline")]
		public string Tagline { get; internal set; }
	}

	public class XPackBuildInformation
	{
		[DataMember(Name ="date")]
		public DateTimeOffset Date { get; internal set; }

		[DataMember(Name ="hash")]
		public string Hash { get; internal set; }
	}

	public class MinimalLicenseInformation
	{
		[DataMember(Name ="expiry_date_in_millis")]
		public long ExpiryDateInMilliseconds { get; set; }

		[DataMember(Name ="mode")]
		public LicenseType Mode { get; internal set; }

		[DataMember(Name ="status")]
		public LicenseStatus Status { get; internal set; }

		[DataMember(Name ="type")]
		public LicenseType Type { get; internal set; }

		[DataMember(Name ="uid")]
		public string UID { get; internal set; }
	}

	public class XPackFeatures
	{
		[DataMember(Name = "analytics")]
		public XPackFeature Analytics { get; internal set; }

		[DataMember(Name = "ccr")]
		public XPackFeature Ccr { get; internal set; }

		[DataMember(Name = "enrich")]
		public XPackFeature Enrich { get; internal set; }

		[DataMember(Name = "frozen_indices")]
		public XPackFeature FrozenIndices { get; internal set; }

		[DataMember(Name = "graph")]
		public XPackFeature Graph { get; internal set; }

		// TODO! Expand to fullname in 8.0?
		[DataMember(Name = "ilm")]
		public XPackFeature Ilm { get; internal set; }

		[DataMember(Name = "logstash")]
		public XPackFeature Logstash { get; internal set; }

		[DataMember(Name = "ml")]
		public XPackFeature MachineLearning { get; internal set; }

		[DataMember(Name = "monitoring")]
		public XPackFeature Monitoring { get; internal set; }

		[DataMember(Name = "rollup")]
		public XPackFeature Rollup { get; internal set; }

		[DataMember(Name = "security")]
		public XPackFeature Security { get; internal set; }

		[DataMember(Name = "slm")]
		public XPackFeature SnapshotLifecycleManagement { get; internal set; }

		[DataMember(Name = "spatial")]
		public XPackFeature Spatial { get; internal set; }

		[DataMember(Name = "sql")]
		public XPackFeature Sql { get; internal set; }

		[DataMember(Name = "transform")]
		public XPackFeature Transform { get; internal set; }

		[DataMember(Name = "vectors")]
		public XPackFeature Vectors { get; internal set; }

		[DataMember(Name = "voting_only")]
		public XPackFeature VotingOnly { get; internal set; }

		[DataMember(Name = "watcher")]
		public XPackFeature Watcher { get; internal set; }
	}

	public class XPackFeature
	{
		[DataMember(Name = "available")]
		public bool Available { get; internal set; }

		[DataMember(Name ="description")]
		public string Description { get; internal set; }

		[DataMember(Name ="enabled")]
		public bool Enabled { get; internal set; }
	}
}
